package com.wuhunyu.controller;

import com.wuhunyu.commonutils.jwt.JwtUtils;
import com.wuhunyu.service.WeChatBackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 微信扫码回调控制器
 *
 * @author wuhunyu
 * @version 1.0
 * @date 2021-01-24 9:46
 */
@Controller
//@CrossOrigin
@RequestMapping("/api/ucenter/wx")
public class WeChatBackController {

    @Autowired
    private WeChatBackService weChatBackService;

    @GetMapping("/callback")
    public String back(@RequestParam("code") String code, @RequestParam("state") String state) {
        return "redirect:" + weChatBackService.back(code);
    }

}
